//
//  MyTabBar.m
//  BeautyBaoUnion
//
//  Created by 肖智 on 2016/10/20.
//  Copyright © 2016年 肖智. All rights reserved.
//

#import "MyTabBar.h"
@implementation MyButton
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        [self addTarget:self action:@selector(showUnlight:) forControlEvents:UIControlEventAllTouchEvents];
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return self;
}
- (void)showUnlight:(UIButton *)button{
    self.highlighted = NO;
}
- (CGRect)titleRectForContentRect:(CGRect)contentRect{
    CGPoint point = CGPointMake(self.bounds.size.width/2.0, self.bounds.size.height/2.0);
    return CGRectMake(0, point.y+3, self.bounds.size.width, 20);
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect{
    CGPoint point = CGPointMake(self.bounds.size.width/2.0, self.bounds.size.height/2.0);
    return CGRectMake((self.bounds.size.width-self.imageSize.width)/2.0, point.y-self.imageSize.height+2, self.imageSize.width, self.imageSize.height);
}
@end
@interface MyTabBar(){
    NSArray *imageNomalArray;
    NSArray *imageSelectArray;
    NSArray *titleArray;
    MyButton *selectedBtn;
    MyButton *firstBtn;
}

@end
@implementation MyTabBar
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        [self commonSettings];
        self.backgroundColor = [UIColor whiteColor];
        UIView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 1.0)];
        ;
        line.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.2];
        [self addSubview:line];
        [self layoutButtons];
    }
    return self;
}
- (void)commonSettings{
    
}
- (void)layoutButtons{
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
